package com.jvm.chapter2;

import org.junit.Test;

import java.util.ArrayList;
import java.util.List;
import java.util.Random;

/**
 * Created by 85243 on 2017/4/15.
 */
public class Demo1 {
    public static void main(String[] args) {
        new Demo1().test01();
    }

    /**
     * 内存溢出异常测试,
     * Xms堆的最小值,Xmm堆的最大值
     */
    //vm args: -Xms20m -Xmx20m -XX:+HeapDumpOnOutOfMemoryError
    //把后面的参数填到vm options中
    @Test
    public void test01(){
        List<People> list = new ArrayList();
        Random random = new Random(10);;
        while(true){
            list.add(new People(String.valueOf(random.nextInt(20))));
        }
    }
}

/**
 * SELECT * FROM java.lang.String
 */
class People {
    String name ;

    public People(String name) {
        this.name = name;
    }
}
